package com.mdxl.first.util;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import org.springside.modules.utils.PropertiesUtils;

public class KeegooConfig {
	
	public static String mongoDBHOSTS;
	public static String mongoDBPORTS;
	public static String mongoDBIP;
	public static String mongoDBPORT;
	/** mogoDB 名称 */
	public static String mongoDBName;
	public static String mongoDBCheck;
	/** mongodb连接数 */
	public static String mongodbConnectionsCount;
	
	/**
	 * mongodb写
	 */
	public static String mongoDBWriteHOSTS;
	public static String mongoDBWritePORTS;
	public static String mongoDBWriteIP;
	public static String mongoDBWritePORT;
	public static String mongoDBWriteName;
	public static String mongoDBWriteCheck;
	public static String mongodbWriteConnectionsCount;
	
	/**
	 * mongodb读
	 */
	public static String mongoDBReadHOSTS;
	public static String mongoDBReadPORTS;
	public static String mongoDBReadIP;
	public static String mongoDBReadPORT;
	public static String mongoDBReadName;
	public static String mongoDBReadCheck;
	public static String mongodbReadConnectionsCount;
	

	public static Boolean publishFilter;
	public static Boolean addAPIFilter;
	public static Boolean remoteGrab;
	public static String remoteGrabUrl;
	
	public static String uploadFileDirector;
	public static String imgUrl;
	
	public static String messageTitle;
	
	public static String smsChannelTrigger;
	
	public static String notifyUrl;
	
	public static String orderUpdateTime=null;

	public static Integer groupOrderOverTime=24*60-1;
	public static Integer orderOverTime =30;
	public static Integer activityOrderOverTime=15;
	
	/** 主机HOST参数 **/
	public static String HOST_NAME;
	public static String HOST_NAME_ENCODE;
	
	/** 作品URL参数 **/
	public static String  PRODUCT_URL;
	
	/** 二维码参数 **/
	public static String QRCODE_DOMAIN;
	public static String QRCODE_OUTPUT_PATH;
	
	/** 七牛参数 **/
	public static String QIQIU_FILE_ACCESS_KEY;
	public static String QIQIU_FILE_SECRET_KEY;
	public static String QIQIU_FILE_BUCKETNAME;
	public static String QIQIU_FILE_UPLOAD_URL;
	
	/** 微信参数 **/
	public static String WEIXIN_APP_ID;
	public static String WEIXIN_APP_SECRET;
	public static String WEIXIN_AUTOREPLY_TOKEN;
	public static String WEIXIN_AUTOREPLY_ENCODINGAESKEY;
	/**
	 * 微信商铺证书存放路径
	 */
	public static String WEIXIN_SHOP_CERT_FILE_PATH;
	
	/**
	 * 通知专栏开通请求地址
	 */
	public static String NOTIFY_ZL_OPENURL;
	/**
	 * 通知课堂开通请求地址
	 */
	public static String NOTIFY_KT_OPENURL;
	
	/**
	 * 平台秘钥信息，目前只有脚印和直播间
	 */
	public static Map<String,String> PLATFORM_MAP = new HashMap<String,String>();
	
	static{
		try {
			Properties p = PropertiesUtils.loadProperties("application.properties");
			/**
			 * mongodb配置
			 */
			mongoDBName= p.getProperty("mongoDBName");
			mongodbConnectionsCount= p.getProperty("mongodbConnectionsCount");
			mongoDBHOSTS = p.getProperty("mongoDBHOSTS");
			mongoDBPORTS = p.getProperty("mongoDBPORTS");
			mongoDBIP= p.getProperty("mongoDBIP");
			mongoDBPORT= p.getProperty("mongoDBPORT");
			mongoDBCheck= p.getProperty("mongoDBCheck");
			
			mongoDBWriteName= p.getProperty("mongoDBWriteName");
			mongodbWriteConnectionsCount= p.getProperty("mongodbWriteConnectionsCount");
			mongoDBWriteHOSTS = p.getProperty("mongoDBWriteHOSTS");
			mongoDBWritePORTS = p.getProperty("mongoDBWritePORTS");
			mongoDBWriteIP= p.getProperty("mongoDBWriteIP");
			mongoDBWritePORT= p.getProperty("mongoDBWritePORT");
			mongoDBWriteCheck= p.getProperty("mongoDBWriteCheck");
			
			mongoDBReadName= p.getProperty("mongoDBReadName");
			mongodbReadConnectionsCount= p.getProperty("mongodbReadConnectionsCount");
			mongoDBReadHOSTS = p.getProperty("mongoDBReadHOSTS");
			mongoDBReadPORTS = p.getProperty("mongoDBReadPORTS");
			mongoDBReadIP= p.getProperty("mongoDBReadIP");
			mongoDBReadPORT= p.getProperty("mongoDBReadPORT");
			mongoDBReadCheck= p.getProperty("mongoDBReadCheck");
			
			uploadFileDirector = p.getProperty("uploadFileDirector");
			imgUrl = p.getProperty("imgUrl");
			messageTitle = p.getProperty("messageTitle");
			smsChannelTrigger = p.getProperty("smsChannelTrigger");
			publishFilter = DataTypeUtils.isNotEmpty(p.getProperty("publishFilter"))?Boolean.valueOf(p.getProperty("publishFilter")):true;
			addAPIFilter = DataTypeUtils.isNotEmpty(p.getProperty("addAPIFilter"))?Boolean.valueOf(p.getProperty("addAPIFilter")):true;
			remoteGrab = DataTypeUtils.isNotEmpty(p.getProperty("remoteGrab"))?Boolean.valueOf(p.getProperty("remoteGrab")):false;
			remoteGrabUrl = p.getProperty("remoteGrabUrl");
			notifyUrl=p.getProperty("notify.url");
			
			HOST_NAME = p.getProperty("HOST_NAME");
			HOST_NAME_ENCODE = p.getProperty("HOST_NAME_ENCODE");
			
			PRODUCT_URL = p.getProperty("PRODUCT_URL");
			
			QRCODE_OUTPUT_PATH = p.getProperty("QRCODE_OUTPUT_PATH");
			QRCODE_DOMAIN = p.getProperty("QRCODE_DOMAIN");
			
			QIQIU_FILE_ACCESS_KEY = p.getProperty("QIQIU_FILE_ACCESS_KEY");
			QIQIU_FILE_SECRET_KEY = p.getProperty("QIQIU_FILE_SECRET_KEY");
			QIQIU_FILE_BUCKETNAME = p.getProperty("QIQIU_FILE_BUCKETNAME");
			QIQIU_FILE_UPLOAD_URL = p.getProperty("QIQIU_FILE_UPLOAD_URL");
			
			WEIXIN_APP_ID = p.getProperty("WEIXIN_APP_ID");
			WEIXIN_APP_SECRET = p.getProperty("WEIXIN_APP_SECRET");
			
			WEIXIN_AUTOREPLY_TOKEN=p.getProperty("WEIXIN_AUTOREPLY_TOKEN");
			WEIXIN_AUTOREPLY_ENCODINGAESKEY=p.getProperty("WEIXIN_AUTOREPLY_ENCODINGAESKEY");

			WEIXIN_SHOP_CERT_FILE_PATH = p.getProperty("WEIXIN_SHOP_CERT_FILE_PATH");
			
			//加入平台信息
			PLATFORM_MAP.put("DJKJ100001", "assdaad1231223c9dae42e06fd7b21e2");//直播间
			PLATFORM_MAP.put("DJKJ100002", "c92fd80sdas357c9dae42asdd7b21123");//脚印
			PLATFORM_MAP.put("DJKJ100003", "d80sdas357c9c9dae42e06daad1231d7");//脚印课堂
			PLATFORM_MAP.put("DJKJ100004", "2e06d2310sdaad1as357cd7d89c9dae4");//脚印小组
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
